<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>消息提醒-{$system['name']}后台管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/static/plugins/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/static/admin/css/global.css" media="all">

    <script src="/static/common/js/jquery.min.js"></script>
    <script src="/static/plugins/layui/lay/modules/layer.js"></script>
    <script src="/static/js/date/date.format.js"></script>
    <style>

        .filtrate-warp{
            margin-bottom: 10px;
        }

        .filtrate-warp .title{
            padding: 5px 12px 7px 12px;
            font-size: 14px;
            font-weight: normal;
            text-align: left;
            cursor: pointer;
            width: 90px;
            background-color: transparent!important;
            color: black!important;
        }

        .filtrate-warp .title:hover{
            color: black;
        }

        .filtrate-warp .flag{
            padding: 6px 12px 6px 12px;
            cursor: pointer;
        }

        .filtrate-warp .flag:hover{
            color: black;
        }

        .filtrate-warp .layui-badge:hover{
            color: white!important;
        }

    </style>

</head>
<body class="skin-<?php if(!empty($_COOKIE['skin'])){echo $_COOKIE['skin'];}else{echo '0';setcookie('skin','0');}?>">

<div class="admin-main layui-anim layui-anim-upbit">


    <fieldset class="layui-elem-field " >
        <legend>高级查询</legend>

        <div class="layui-card" style="box-shadow: none;margin-top: 10px">
            <div class="layui-form layui-card-header layuiadmin-card-header-auto" style="border-bottom: transparent;height: auto" >

                <div class="layui-form-item" style="text-align: left;padding-left: 20px;">

                    <div class="layui-inline">
                        <label class="layui-form-label">类型：</label>
                        <div class="layui-input-inline">
                            <select name="title">
                                <option value="">请选择类型</option>
<?php
$titleLst=\think\facade\Db::name('ymwl_todo')->field('title')->group('title')->select();
                                ?>
                                {volist name='titleLst' id='vo'}
                                <option value="{$vo.title}">{$vo.title}</option>
                                {/volist}

                            </select>
                        </div>
                    </div>

                    <div class="layui-inline">
                        <label class="layui-form-label">处理状态：</label>
                        <div class="layui-input-inline">
                            <select name="result">
                                <option value="">请选择处理状态</option>
                                <?php
$titleLst=\think\facade\Db::name('ymwl_todo')->field('result')->group('result')->select();

                                ?>
                                {volist name='titleLst' id='vo'}
                                <option value="{$vo.result}">{$vo.result}</option>
                                {/volist}

                            </select>
                        </div>
                    </div>




                </div>



                <div class="layui-inline" style="float: right;padding-bottom: 15px">
                    <button class="layui-btn layuiadmin-btn-list"  lay-submit lay-filter="LAY-app-contlist-search">
                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"  style="vertical-align: sub;"></i>查询数据
                    </button>
                </div>

            </div>
        </div>



    </fieldset>



    <table class="layui-table" id="table-list" lay-filter="table-list"></table>
</div>


<?php
$aid=$admin['admin_id'];
$group_id=\think\facade\Db::name('admin')->where('admin_id',$aid)->cache('group_id_'.$aid)->value('group_id');
?>

<script type="text/html" id="action">
    {{# if(d.is_finish==0 && d.show_auth_group_id.indexOf(",{$group_id},")>=0){ }}
    <a class="layui-btn  layui-btn-xs" lay-event="audit"><i class="layui-icon">&#xe642;</i>审核</a>
    {{# } }}
    <?php  if(auth('Process.todo/del')){ ?>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon">&#xe640;</i>删除</a>
    <?php  } ?>

</script>


<script type="text/html" id="topBtn">
    <?php  if(auth('Process.todo/del')){ ?>
    <button type="button" class="layui-btn layui-btn-danger layui-btn-radius layui-btn-sm" id="selectDel" lay-event="selectDel"><i class="layui-icon">&#xe640;</i>删除</button>
    <?php  } ?>
</script>
{include file="common/foot"/}
<script>

    layui.use(['table','form','upload','util','laydate'], function() {
        var table = layui.table,form = layui.form,laydate = layui.laydate, $ = layui.jquery,upload = layui.upload,util = layui.util;
        var tableIn = table.render({
            elem: '#table-list',
            url: '{:url("index")}',
            method: 'post',
            toolbar: '#topBtn',
            defaultToolbar:['filter','print','exports'],
            cols: [[
                {checkbox:true,fixed: true},
                {field: 'id', title: 'ID', fixed: true},
                {field: 'realname', title: '发起者'},
                {field: 'title', title: '类型'},
                {field: 'mess', title: '内容',width: 200 },
                {field: 'createtime', title: '创建时间',templet:function (res) {
                        return new Date(res.createtime*1000).format('Y-m-d H:i:s');
                    } },
                {field: 'result', title: '处理状态' },
                {field: 'result_mess', title: '处理说明',width: 200 },
                {field: 'reviewer', title: '处理者' },
                {field: 'audittime', title: '处理时间' ,templet:function (res) {
                    if(res.audittime<1)return '';
                        return new Date(res.audittime*1000).format('Y-m-d H:i:s');

                    }},
                {title: '操作',align: 'center', toolbar: '#action'}
            ]],
            limit: {$system['more']['admin_pagesize']}, //每页默认显示的数量

            page: {limits:[10, 20, 30, 40, 50,100,1000]},
        });


        table.on('tool(table-list)', function(obj) {
            var data = obj.data;

            if (obj.event === 'del') {
                layer.confirm('您确定要删除这条消息吗？', function(index){
                    var loading = layer.load(1, {shade: [0.1, '#fff']});
                    $.post("{:url('del')}",{id:data.id},function(res){
                        layer.close(loading);
                        if(res.code===0){
                            layer.msg(res.msg,{time:2000,icon:1});
                            tableIn.reload();
                        }else{
                            layer.msg('操作失败！',{time:2000,icon:2});
                        }
                    });
                    layer.close(index);
                });
            }
            else if(obj.event === 'audit'){
                layer.open({
                    type: 2,
                    title: data.title,
                    shadeClose: true,
                    shade: false,
                    area: ['80%', '100%'],
                    content: '/admin/'+data.url+'&tudo_id='+data.id
                });
            }
        });


        $('body').on('click','#add',function() {
            var indexOpen = layer.open({
                type: 2,
                title: '添加客户',
                closeBtn: 1, //是否显示关闭按钮
                area: ['100%','86%'],
                anim: 2,  //动画
                shadeClose: false,  //点击空白处是否关闭
                maxmin: false, //开启最大化最小化按钮
                content: ["{:url('Client/add')}"]
            });
        })



        //监听事件
        table.on('toolbar(table-list)', function(obj){

            var checkStatus = table.checkStatus(obj.config.id)
                ,data = checkStatus.data; //获取选中的数据
            switch(obj.event){
                case 'selectDel':
                    if(data.length > 0){
                        alterList = [];  //定义需要转移的数组
                        data.forEach(function (obj,index) {
                            alterList.push(obj.id);
                        });
                        currConfirm = layer.confirm('您确定要删除勾选的消息吗？',function (index) {
                            var loading = layer.load(1, {shade: [0.1, '#fff']});
                            $.post("{:url('del')}",{id:alterList},function(res){
                                layer.close(loading);
                                if(res.code===0){
                                    layer.msg(res.msg,{time:2000,icon:1});
                                    tableIn.reload();
                                }else{
                                    layer.msg('操作失败！',{time:2000,icon:2});
                                }
                            });
                            layer.close(index);
                        });
                    }else {
                        layer.msg("请选择需要删除的消息");
                    }
                    break;
            };
        });


//监听搜索
        form.on('submit(LAY-app-contlist-search)', function(data){
            var field = data.field;
            table.reload('table-list', {
                url:"{:url('index')}",
                where: {
                    keyword: data.field
                },
                page:{
                    curr:1
                }
            });


        });
    });
</script>


<script>

    /*添加*/
    function layer_add(title,url){
        
        var indexOpen = layer.open({
            type: 2,
            title: title,
            closeBtn: 1, //是否显示关闭按钮
            area: ['100%','80%'],
            anim: 2,  //动画
            shadeClose: false,  //点击空白处是否关闭
            maxmin: true, //开启最大化最小化按钮
            content:[url],
        });
    }
</script>

</body>
</html>